@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 代码块样式 - 优化避免横向滚动 */
.code-block {
  position: relative;
  background: #282c34;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #3a3f4b;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre;
  word-wrap: normal;
  word-break: normal;
}

.code-block code {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  display: block;
  white-space: pre;
  word-wrap: normal;
  color: #abb2bf !important;
}

/* 代码高亮颜色 - One Dark主题 */
.code-block .hljs {
  color: #abb2bf !important;
}

.code-block .hljs-keyword {
  color: #c678dd !important;
}

.code-block .hljs-string,
.code-block .hljs-doctag {
  color: #98c379 !important;
}

.code-block .hljs-comment,
.code-block .hljs-quote {
  color: #5c6370 !important;
  font-style: italic;
}

.code-block .hljs-function,
.code-block .hljs-title {
  color: #61afef !important;
}

.code-block .hljs-variable,
.code-block .hljs-attr,
.code-block .hljs-attribute,
.code-block .hljs-params {
  color: #e06c75 !important;
}

.code-block .hljs-number,
.code-block .hljs-literal {
  color: #d19a66 !important;
}

.code-block .hljs-built_in,
.code-block .hljs-builtin-name {
  color: #e6c07b !important;
}

.code-block .hljs-tag {
  color: #e06c75 !important;
}

.code-block .hljs-name,
.code-block .hljs-selector-tag {
  color: #e06c75 !important;
}

.code-block .hljs-selector-class {
  color: #d19a66 !important;
}

.code-block .hljs-selector-id {
  color: #61afef !important;
}

/* Bash脚本特殊处理 */
.code-block .language-bash,
.code-block .language-sh {
  color: #98c379 !important;
}

.code-block .language-bash .hljs-variable {
  color: #e6c07b !important;
}

/* 默认文本颜色 - 加强优先级 */
.code-block,
.code-block * {
  color: #abb2bf !important;
}

.code-block pre,
.code-block pre code,
.code-block pre code * {
  color: inherit !important;
}

/* 确保未高亮的代码也有颜色 */
.code-block pre code:not(.hljs) {
  color: #abb2bf !important;
}

.code-block pre code.hljs {
  color: #abb2bf !important;
}

/* 保持代码可读性的滚动条 */
.code-block pre::-webkit-scrollbar {
  height: 6px;
  background: transparent;
}

.code-block pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.code-block pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 幻灯片切换动画 */
.slide-enter {
  opacity: 0;
  transform: translateX(100px);
}

.slide-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: all 0.5s ease-in-out;
}

.slide-exit {
  opacity: 1;
  transform: translateX(0);
}

.slide-exit-active {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.5s ease-in-out;
}

/* 打字机效果 */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink {
  50% { border-color: transparent }
}

.typewriter {
  overflow: hidden;
  border-right: 3px solid;
  white-space: nowrap;
  animation:
    typing 3.5s steps(40, end),
    blink .75s step-end infinite;
}

/* 渐变文字 */
.gradient-text {
  background: linear-gradient(90deg, #8B5CF6 0%, #EC4899 50%, #06B6D4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 修复Ant Design菜单文字显示问题 */
.ant-menu-item {
  display: flex !important;
  align-items: center !important;
}

.ant-menu-item .ant-menu-title-content {
  display: inline-block !important;
  color: #333 !important;
  font-size: 14px !important;
  margin-left: 8px !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  overflow: visible !important;
}

.ant-menu-item .ant-menu-item-icon {
  min-width: 20px !important;
  font-size: 16px !important;
  color: #666 !important;
}

.ant-menu-vertical .ant-menu-item {
  margin: 4px 0;
  height: auto !important;
  line-height: 1.5 !important;
  padding: 8px 12px !important;
  white-space: normal !important;
}

.ant-menu-item-selected {
  background-color: rgba(139, 92, 246, 0.1) !important;
}

.ant-menu-item-selected .ant-menu-title-content {
  color: #8B5CF6 !important;
  font-weight: 600 !important;
}